﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace IB_report_stand.DAL
{
    class DataContextFactory
    {
        public static DataObjectsDataContext CreateDataContext()
        {
            DataObjectsDataContext db;

            String connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

            if (connectionString == null || connectionString.Length < 1)
            {
                db = new DataObjectsDataContext();
            }
            else {
                db = CreateDataContext(connectionString);
            }
            return db;
        }


        public static DataObjectsDataContext CreateDataContext(string connectionString)
        {

            DataObjectsDataContext db = new DataObjectsDataContext(connectionString);
            return db;
        }
    }
}
